package com.itita.ww2.game.user;

import com.smartfoxserver.v2.entities.data.ISFSObject;
import com.smartfoxserver.v2.entities.data.SFSObject;

/**
 * 玩家科技
 * @author NorthLan
 *
 */
public class UserScience {
	private String code; // 科技代号
	private int level; // 科技等级

	public UserScience(String code, int level) {
		this.code = code;
		this.level = level;
	}

	public void upgrade() {
		// TODO 升级科技
		
	}

	public void upgradeComplete() {
		// TODO 升级科技完成
	}

	public static UserScience newFromJsonData(ISFSObject data) {
		return new UserScience(data.getUtfString("code"), data.getInt("lv"));
	}

	public ISFSObject toSFSObject() {
		ISFSObject ret = SFSObject.newInstance();
		ret.putInt("lv", level);
		ret.putUtfString("code", code);
		return ret;
	}

	
	public String getCode() {
		return code;
	}

	public int getLevel() {
		return level;
	}
}
